package com.hnu.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnu.common.Constants;
import com.hnu.dto.ProductDto;
import com.hnu.dto.Result;
import com.hnu.entity.Admin;
import com.hnu.entity.Order;
import com.hnu.entity.User;
import com.hnu.service.OrderService;
import com.hnu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author hj
 * @Date 2023/12/20 8:49
 * @PackageName:com.hnu.controller
 * @ClassName: AdminController
 * @Description: create a class
 * @Version 1.0
 */
@CrossOrigin //服务器端解决跨域
@RequestMapping("/order")
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;
    @Autowired
    private UserService userService;

    /**
     * 分页查询所有订单
     *
     * @param pageNum
     * @param pageSize
     * @return
     */
    @PostMapping("/findAll/{pageNum}/{pageSize}")
    public Result findAll(@PathVariable int pageNum,
                          @PathVariable int pageSize) {
        Page<Order> page = orderService.page(new Page<>(pageNum, pageSize));
        return Result.ok(Constants.OK).data(page);
    }






}
